NexusPi Git Node
Commit f0aee0671e84b627f90883c0f1fca8f0d4dbc9da
Parents : 5f5fadb
Author : Chad Attermann <attermann@gmail.com>
Date : 2026-06-24T11:22:27-06:00
Fixed heatshrink decoding issue
Changes
Diff
diff --git a/webconsole/index.html b/webconsole/index.html
index 598b0e2..f9d81f3 100644
--- a/webconsole/index.html
+++ b/webconsole/index.html
@@ -1345,9 +1345,18 @@ function heatshrinkDecode(input){
// ranges 1..(2^lookahead_bits - 1) → real_length 2..(2^lb).
const offset = offRaw + 1;
const length = lenRaw + 1;
+ // The C encoder/decoder both pre-zero a (1<<HS_WINDOW_BITS) byte
+ // sliding window (memset in heatshrink_{en,de}coder.c::reset), and
+ // the encoder is allowed to emit backrefs that point into that
+ // zero region — i.e., "before" any byte has actually been emitted.
+ // Treat negative indices as that virtual zero source rather than
+ // bailing; bailing silently truncates every stream that compresses
+ // an early zero run (common for msgpack float64 metrics).
const start = out.length - offset;
- if (start < 0) break; // malformed input — bail rather than wrap
- for (let i = 0; i < length; i++) out.push(out[start + i]);
+ for (let i = 0; i < length; i++) {
+ const idx = start + i;
+ out.push(idx < 0 ? 0 : out[idx]);
+ }
}
}
return new Uint8Array(out);
Served by rngit 1.5.2 - Generated in 0.02s